<!DOCTYPE html>
<html>

<head>
    <title>PointOverlay-Dluster</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body,
        html {
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }

        #allmap {
            width: 100%;
            height: 100%;
        }

        p {
            margin-left: 5px;
            font-size: 14px;
        }
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=U3q69k0Dv0GCYNiiZeHPf7BS"></script>
    <script src="../dist/inmap.js"></script>
    <script src="data/data.js"></script>

</head>

<body>
    <div id="allmap"></div>
</body>

</html>
<script>
    var map = new inMap.Map({
        id: 'allmap',
        skin: "Blueness",
        center: [105.403119, 38.028658],
        zoom: {
            value: 5,
            show: true,
            max: 18,
            min: 5
        },
    })
    var overlay = new inMap.PointOverlay({
        tooltip: {
            show: true,

            // formatter: function (params) {
            //     return params.count;
            // }
            formatter: "{count}"
        },
        legend: {
            show: true,
            title: "标题",
            formatter: function (val, index) {
                return val + "万";
            },

        },
        style: {
            normal: {
                backgroundColor: 'rgba(200, 200, 50, 1)',
                borderWidth: 1,
                borderColor: "rgba(255,255,255,1)",
                size: 10,
            },
            mouseOver: {
                backgroundColor: 'rgba(200, 200, 200, 1)',
                borderColor: "rgba(255,255,255,1)",
                borderWidth: 4,
                scale: 1,
            },
            colors: [
                "rgba(156,200,249,0.7)", "rgba(93,158,247,0.7)",
                "rgba(134,207,55,0.7)",
                "rgba(252,198,10,0.7)", "rgba(255,144,0,0.7)", "rgba(255,72,0,0.7)",
                "rgba(255,0,0,0.7)"
            ],
            selected: {
                backgroundColor: 'rgba(184,0,0,1)',
                borderColor: "rgba(255,255,255,1)"
            },
            splitList: [{ //设置区间颜色
                    start: 0,
                    end: 2,
                    size: 3,
                    backgroundColor: 'rgba(200, 200, 50, 1)',
                },
                {
                    start: 2,
                    end: 5,
                    size: 6,
                    backgroundColor: 'rgba(200, 200, 50, 1)',
                },
                {
                    start: 5,
                    end: 7,
                    size: 9,
                    backgroundColor: 'rgba(200, 200, 50, 1)',
                },
                {
                    start: 7,
                    size: 12,
                    backgroundColor: 'rgba(200, 200, 50, 1)',
                }
            ],
        },
        data: data.map(function (item, index) {
            item.name = '散点' + index;
            item.count = item.count || index;
            return item;
        }),
        event: {
            onMouseClick: function (item) {
                //能获取当前点的信息
            }
        }
    });
    map.add(overlay);
</script>